import React, {Fragment, PureComponent} from 'react';
import {Form, Icon} from 'antd';
import DescriptionList from '@/components/DescriptionList';
import styles from '../PrivateFile.less';

const {Description} = DescriptionList;
const FormItem = Form.Item;

/**
 * 个人文件，显示当前的文件目录一行  数学》英语》a.doc
 */
@Form.create()
class DirLine extends PureComponent {
  formLayout = {
    labelCol: {span: 7},
    wrapperCol: {span: 13},
  };

  render() {
    const {dirs, onDirSelect} = this.props;
    let dirButtons = [];
    if (dirs && dirs.length) {
      dirs.forEach((item, index) => {
        dirButtons.push(
          <Fragment key={index}>
            {/*<span style={{color:'#ccc',display:item.id == index ? 'none' : ''}}>-</span>&nbsp;*/}
            <span style={{color: '#ccc', display: ''}}>-</span>&nbsp;
            <a className={styles.filePathLink} onClick={() => onDirSelect(item)}>{item.dirName}</a>&nbsp;
          </Fragment>
        );
      })
    }
    return <div style={{marginBottom: '10px'}}><Icon type="environment"/>&nbsp;{dirButtons}</div>;
  }
}

export default DirLine;
